<%@ page contentType="text/html; charset=utf-8"%>
<%@include file="/global/jsp-head.jsp"%>
<%
	Date curdate = new Date();
	request.setAttribute("curhour",curdate.getHours());
	request.setAttribute("curminute",curdate.getMinutes());
	request.setAttribute("cursecond",curdate.getSeconds());
%>
<%@page import="java.util.Date"%>
<c:if test="${z:rbac('/common/no-operatedo',pageContext.request)
	|| z:rbac('/common/no-callout.do',pageContext.request)}">
<script>
var curHour = parseInt("${curhour}");
var curMinute = parseInt("${curminute}");
//var curSecond = parseInt("${cursecond}");
var index = 0;
function statTime(minutes){
	//curMinute+=parseInt(time/60,0);
	curHour+=parseInt(minutes/60,0);
	//curSecond=time%60;
	curMinute=minutes%60;
	curHour=curHour%24;
}
$(function(){
	setInterval(function(){statTime(curMinute += 1)},1000*60*1);	
})
</script>
</c:if>
<%-- 限制工作时间-禁止操作 --%>
<c:if test="${z:rbac('/common/no-operatedo',pageContext.request)}">
<script type="text/javascript">
index = 0;
function noOperate(){
	index +=1;
	//每天晚上22点到第二天早上7点
	if((curHour>=22 && curHour<=23) || (curHour>=0 && curHour<=7)){
	//if((curHour>=16 && curMinute>=52 && curHour<=17) || (curHour>=17 && curHour<=17)){
		$('table.dblclickTable tbody tr').each(function(){
			$(this).unbind("dblclick");
			$(this).removeAttr("ondblclick");
		});
		$('table.dblclickTable tbody tr').dblclick(function(){
			alert("亲，现在是休息时间哦~请休息下吧！");
			return false;
		});
		$(':submit,:button,.button,a,.cpt,.sst,.link').each(function(){
			$(this).unbind("click");
			$(this).removeAttr("onclick");
		});
		$(':submit,:button,.button,a,.cpt,.sst,.link').bind("click",function(){
			alert("亲，现在是休息时间哦~请休息下吧！");
			return false;
		});
	}
}
$(function(){
	if(index < 3){
		setInterval(noOperate,1000);
	}else{
		setInterval(noOperate,1000*60*2);
	}
});
</script>
</c:if>
<%-- 限制工作时间-禁止呼出 --%>
<c:if test="${z:rbac('/common/no-callout.do',pageContext.request)}">
<script>
index = 0;
function noCallOut(){
	index +=1;
	//每天晚上21点30分到第二天早上7点
	if((curHour>=21 && curMinute>=30 && curHour<=23) || (curHour>=0 && curHour<=7)){
	//if((curHour>=16 && curMinute>=50 && curHour<=17) || (curHour>=17 && curHour<=17)){
		$('.cpt').each(function(){
			$(this).unbind("click");
			$(this).removeAttr("onclick");
		});
		$('.cpt').bind("click",function(){
			if((curHour>=22 && curHour<=23) || (curHour>=0 && curHour<=7)){
			//if(curMinute>=52){
				alert("亲，现在是休息时间哦~请休息下吧！");
			}else{
				alert("亲，现在是盘库时间，禁止呼出哦！");
			}
			return false;
		});
	}
}
$(function(){
	if(index < 3){
		setInterval(noCallOut,1000);
	}else{
		setInterval(noCallOut,1000*60*2);
	}
});
</script>
</c:if>